package com.ikaros.converter;

import com.ikaros.dto.OrderDTO;
import com.ikaros.entity.OrderMaster;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 转换器
 * Created by Ikaros on 2017/10/21.
 */
public class OrderMaster2OrderDTOConverter {
    public static OrderDTO converter(OrderMaster orderMaster){
        OrderDTO orderDTO=new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> converter(List<OrderMaster> orderMasterList){
        return orderMasterList.parallelStream().map(e->
                converter(e)
        ).collect(Collectors.toList());
    }
}
